home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / interapplication comm / moreosl / moreresources / moreresources.h < prev   
Encoding:
C/C++ Source or Header  |  2000-06-23  |  2.9 KB  |  92 lines

  1. /*
  2.     File:        MoreResources.h
  3.  
  4.     Contains:    Resource Manager utilities
  5.  
  6.     Written by:    Quinn
  7.  
  8.     Copyright:    Copyright © 2000 by Apple Computer, Inc., all rights reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <3>     20/3/00    Quinn   #include <Files.h> to get it to build.
  21.          <2>      3/9/00    gaw     API changes for MoreAppleEvents
  22.          <1>      6/3/00    Quinn   First checked in.
  23. */
  24.  
  25. #pragma once
  26.  
  27. /////////////////////////////////////////////////////////////////
  28.  
  29. // MoreIsBetter Setup
  30.  
  31. #include "MoreSetup.h"
  32.  
  33. // Mac OS Interfaces
  34.  
  35. #include <MacTypes.h>
  36. #include <Files.h>
  37.  
  38. /////////////////////////////////////////////////////////////////
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. /******************************************************************************
  44.     Returns ResError() or, if it’s noErr and p is nil,
  45.     returns resNotFound.  The rationale for this routine
  46.     is that, under some documented circumstances, GetResource
  47.     can return nil but not set ResErr.
  48.  
  49.     pResHdl        input:    a resource handle
  50.  
  51.     RESULT CODES
  52.     ____________
  53.     Same as results for ResError
  54.     ____________
  55. */
  56. extern pascal OSErr MoreResError(const void *pResHdl);
  57. /******************************************************************************
  58.     Given an FSSpec to a file, open it with write permission.
  59.     Check to make sure that the file reference returned actually has write
  60.     permission and return an error if it doesn't.
  61.  
  62.     pFSSpec        input:    The file to be opened.
  63.     pRefNum            output:    File reference for the newly opened file.
  64.     
  65.     RESULT CODES
  66.     ____________
  67.         Same as results for FSpOpenResFile()
  68.     ____________
  69. */
  70. extern pascal OSErr MoreResOpenResFileForWrite(const FSSpec *pFSSpec, SInt16 *pRefNum);
  71. /******************************************************************************
  72.     Utility routine to check that a file opened with read/write permission
  73.     does in fact have read/write permission.
  74.     
  75.     It is possible to get a read-only file reference for a resource file that has
  76.     been opened with read/write permission.  This routine verify that a file open
  77.     with read/write permission does in fact have write permission.
  78.  
  79.     pRefNum            input:    File reference number for file to be checked.
  80.     
  81.     RESULT CODES
  82.     ____________
  83.         true        The resource file was really opened with write permission
  84.         false        It wasn't
  85.     ____________
  86. */
  87. extern pascal Boolean MoreResIsResFileRefNumWritable(const SInt16 pRefNum);
  88. //******************************************************************************
  89. #ifdef __cplusplus
  90. };
  91. #endif
  92.